var addressInit = function(_carea, _cmbProvince, _cmbCity, _cmbArea, defaultarea1, defaultProvince, defaultCity,
	defaultArea) {
	var area = document.getElementById(_carea);
	var cmbProvince = document.getElementById(_cmbProvince);
	var cmbCity = document.getElementById(_cmbCity);
	var cmbArea = document.getElementById(_cmbArea);

	function cmbSelect(cmb, str) {
		for (var i = 0; i < cmb.options.length; i++) {
			if (cmb.options[i].value == str) {
				cmb.selectedIndex = i;
				return;
			}
		}
	}

	function cmbAddOption(cmb, str, obj) {
		
		var option = document.createElement("OPTION");
		option.innerHTML = str;
		option.value = str;
		option.obj = obj;
		// cmb.options.add(option);
		cmb.appendChild(option);
		
	}

	function changeCity() {
		cmbArea.options.length = 0;
		if (cmbCity.selectedIndex == -1) return;
		var item = cmbCity.options[cmbCity.selectedIndex].obj;
		for (var i = 0; i < item.areaList.length; i++) {
			cmbAddOption(cmbArea, item.areaList[i], null);
		}
		cmbSelect(cmbArea, defaultArea);
	}

	function changeProvince() {
		cmbCity.options.length = 0;
		cmbCity.onchange = null;
		if (cmbProvince.selectedIndex == -1) return;
		var item = cmbProvince.options[cmbProvince.selectedIndex].obj;
		for (var i = 0; i < item[cmbProvince.selectedIndex].cityList.length; i++) {
			cmbAddOption(cmbCity, item[cmbProvince.selectedIndex].cityList[i].name, item[cmbProvince.selectedIndex].cityList[i]);
		}
		cmbSelect(cmbCity, defaultCity);
		changeCity();
		cmbCity.onchange = changeCity;
	}

	function changeArea() {
		cmbProvince.options.length = 0;
		cmbProvince.onchange = null;
		if (area.selectedIndex == -1) return;
		var item = area.options[area.selectedIndex].obj;
		
		for (var i = 0; i < item.Allcity.length; i++) {
			cmbAddOption(cmbProvince, item.Allcity[i].name, item.Allcity);
		}
		cmbSelect(cmbProvince, defaultProvince);
		changeProvince();
		cmbProvince.onchange = changeProvince;
	}
	for (var i = 0; i < provinceList.length; i++) {
		cmbAddOption(area, provinceList[i]._area, provinceList[i]);
	}
	cmbSelect(area, defaultarea1);
	changeArea();
	area.onchange = changeArea;
}
